package com.pkx.cloud.fse7.dms.grant.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pkx.cloud.fse7.dms.grant.entity.DmsGrant;
import com.pkx.cloud.fse7.dms.grant.service.DmsGrantService;
import com.pkx.cloud.whzx.comn.ORpose;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

/**
 *  控制器
 *
 * @author chenwg
 * @since 2020-11-12
 */
@RestController
@RequestMapping("/dms.grant/dms-grant")
@Api(value = "", tags = "")
@Slf4j
@ORpose
public class DmsGrantController {

    @Autowired
    private DmsGrantService dmsGrantService;

    @ApiOperation("分页列表")
    @GetMapping("/page")
    public Page<DmsGrant> page(Page page, DmsGrant dmsGrant) {
        return dmsGrantService.pageList(page,dmsGrant);
    }

    @ApiOperation("列表")
    @GetMapping("/list")
    public List<DmsGrant> list(DmsGrant dmsGrant) {
        return dmsGrantService.listByEntity(dmsGrant);
    }

    @ApiOperation("详情")
    @GetMapping(value = "/{id}")
    public DmsGrant selectById(@PathVariable("id") Long id) {
        return dmsGrantService.selectById(id);
    }

    @ApiOperation("新增")
    @PostMapping("/")
    public Boolean add(@RequestBody DmsGrant dmsGrant) {
        return dmsGrantService.saveDmsGrant(dmsGrant);
    }

    @ApiOperation("修改")
    @PutMapping("/")
    public Boolean modify(@RequestBody DmsGrant dmsGrant) {
        return dmsGrantService.modify(dmsGrant);
    }

    @ApiOperation("删除(单个条目)")
    @DeleteMapping(value = "/{id}")
    public Boolean deleteById(@PathVariable("id") Long id) {
        return dmsGrantService.deleteById(id);
    }
}
